package com.campus.counseling.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.campus.counseling.entity.PaymentRecord;
import com.campus.counseling.model.vo.PaymentRecordVO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.Map;

public interface PaymentRecordMapper extends BaseMapper<PaymentRecord> {
    
    /**
     * 分页查询支付记录（包含关联信息）
     */
    Page<PaymentRecordVO> selectPaymentPage(Page<PaymentRecord> page, 
                                          @Param("orderNo") String orderNo,
                                          @Param("status") String status);
    
    /**
     * 获取咨询师收入统计
     */
    Page<PaymentRecordVO> selectCounselorPayments(Page<PaymentRecord> page,
                                                 @Param("counselorId") Long counselorId);

    /**
     * 获取收入列表
     */
    Page<PaymentRecordVO> getIncomeList(Page<PaymentRecord> page, String orderNo, String counselorName, 
            String status, String startDate, String endDate);

    /**
     * 获取收入统计
     */
    Map<String, Object> getIncomeStatistics();

    /**
     * 获取上月收入统计
     */
    Map<String, Object> getLastMonthIncomeStatistics();

    /**
     * 更新分发状态
     */
    int updateDistributionStatus(@Param("orderNo") String orderNo,
                               @Param("status") String status,
                               @Param("distributionTime") Date distributionTime,
                               @Param("distributorName") String distributorName,
                               @Param("remark") String remark);
} 